package me.jiatao.spring_mybatis.service;

import me.jiatao.spring_mybatis.mapper.UserMapper;
import me.jiatao.spring_mybatis.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService {
	
	@Autowired
	private UserMapper userMapper;
	
	public List<User> queryAllUser(){
		return userMapper.queryAllUser();
	}
	
	
	public void save(){
		User user1 = new User();
		user1.setAge(19);
		user1.setUserName("xiaoqiang2222");
		user1.setPassword("123456");
		
		this.userMapper.saveUser(user1);
		
//		int index = 1/0;
		
		User user2 = new User();
		
		user2.setAge(19);
		user2.setUserName("daqiang2222");
		user2.setPassword("123456");
		this.userMapper.saveUser(user2);
		
	}
}
